package com.leyou.item.api;

import com.leyou.item.pojo.Category;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Feature:商品分类服务接口
 */
@RequestMapping("category")
public interface CategoryApi {


    /**
     * 根据Pid查询分类
     * @param pid
     * @return
     */
    @GetMapping("list")
    public List<Category> queryCategoryListByParentId(
            @RequestParam(value = "pid", defaultValue = "0") Long pid);

    /**
     * 用于修改品牌信息时，商品分类信息的回显
     * @param bid
     * @return
     */
    @GetMapping("bid/{bid}")
    public List<Category> queryByBrandId(@PathVariable("bid") Long bid);

    /**
     * 新增
     * @param category
     */
    @PostMapping
    public ResponseEntity<Void> saveCategory( Category category);

    /**
     * 更新
     * @param category
     * @return
     */
    @PutMapping
    public ResponseEntity<Void> updateCategory( Category category);
    /**
     * 删除
     * @return
     */
    @DeleteMapping("cid/{cid}")
    public ResponseEntity<Void> deleteCategory(@PathVariable("cid") Long id);


    /**
     * 根据分类id集合查询分类名称
     * @param ids
     * @return
     */
    @GetMapping("names")
    public List<String> queryNameByIds(@RequestParam("ids")List<Long> ids);

    /**
     * 根据分类id集合查询分类名称
     * @param ids
     * @return
     */
    @GetMapping("all")
    public List<Category> queryCategoryByIds(@RequestParam("ids")List<Long> ids);

    /**
     * 根据分类id集合查询分类名称
     * @param id
     * @return
     */
    @GetMapping("all/level/{cid3}")
    public List<Category> queryAllCategoryLevelByCid3(@PathVariable("cid3")Long id);
}
